home *** CD-ROM | disk | FTP | other *** search
/ How Would You Survive? / How Would You Survive (1995)(Grolier)[Mac-PC].iso / mac / SHARED.DIR / 01984_Script_aRandomQuestion < prev    next >
Text File  |  1995-09-13  |  8KB  |  247 lines

  1. property pSprite,pHotSprite,plocationV,plocationH,pNoOfQuestions,pFunction1,¼
  2.         pFunction2,pFunction4,pFunction3,pMylist,pCast,pCast2,¼
  3.         pCast3,pCast4,pCast5,pBeenClicked,pQuestion1,pQuestion2,¼
  4.         pQuestion3,pQuestion4,pDestination,x,pTheQuestion,¼
  5.         pPeriodicTask,pQuestionArt,pThelists,EgyptList,AztecList,¼
  6.         VikingList,phelpStatus,pMySound
  7.  
  8. global gQuestCount, gTheHelpIsOn
  9.  
  10. on birth me, thesprite,theHotSprite,theCast,locationV,locationH,Question1Cast,¼
  11.              NumberofQuestions,theFunction1,theFunction2,theFunction3,¼
  12.              theFunction4,theQuestionList,aSound
  13.   
  14.   set EgyptList = [1501:1, 1502:1, 1503:1, 1504:1, 1505:1, 1506:1, 1507:1, 1508:1, 1509:1, ¼
  15.                                         1510:1, 1511:1, 1512:1, 1513:1, 1514:1, 1515:1, 1516:1, 1517:1, 1518:1,¼
  16.                                         1519:1, 1520:1, 1521:1, 1522:1, 1523:1, 1524:1, 1525:1, 1526:1, 1527:1,¼
  17.                                         1528:1, 1529:1, 1530:1, 1531:1, 1532:1 ]
  18.   set AztecList = [ 1501:1, 1502:1, 1503:1, 1504:1, 1505:1, 1506:1, 1507:1, 1508:1, 1509:1, ¼
  19.                                          1510:1, 1511:1, 1512:1, 1513:1, 1514:1, 1515:1, 1516:1, 1517:1, 1518:1,¼
  20.                                          1519:1, 1520:1, 1521:1, 1522:1, 1523:1, 1524:1, 1525:1, 1526:1, 1527:1, 1528:1]
  21.   set VikingList = [1501:1, 1502:1, 1503:1, 1504:1, 1505:1, 1506:1, 1507:1, 1508:1, 1509:1, ¼
  22.                                            1510:1, 1511:1, 1512:1,¼
  23.                                          1513:1, 1514:1, 1515:1, 1516:1, 1517:1, 1518:1, 1519:1, 1520:1, 1521:1,¼
  24.                                          1522:1, 1523:1, 1524:1, 1525:1, 1526:1, 1527:1, 1528:1, 1529:1, 1530:1,¼
  25.                                           1531:1, 1532:1, 1533:1, 1534:1, 1535:1, 1536:1, 1537:1, 1538:1]
  26.   
  27.   set pPeriodicTask = FALSE
  28.   set pSprite = theSprite
  29.   set pCast = theCast
  30.   set pCast2 = pCast + 1
  31.   set pCast3 = pCast + 2
  32.   set pCast4 = pCast + 3
  33.   set pCast5 = pCast + 4
  34.   set pQuestion1 = Question1Cast
  35.   set pQuestion2 = pQuestion1 + 1
  36.   set pQuestion3 = pQuestion1 + 2
  37.   set pQuestion4 = pQuestion1 + 3
  38.   set pHotSprite = theHotSprite
  39.   set plocationV = locationV
  40.   set plocationH = locationH
  41.   set pNoOfQuestions = NumberofQuestions
  42.   set pFunction1 = theFunction1
  43.   set pFunction2 = theFunction2
  44.   set pFunction3 = theFunction3
  45.   set pFunction4 = theFunction4
  46.   set pQuestionList = theQuestionList
  47.   set pThelists = [EgyptList, AztecList, VikingList]
  48.   set pMylist = getat(pThelists, pQuestionList)
  49.   set pMySound = aSound
  50.   set phelpStatus = 0
  51.   puppetSprite pSprite, TRUE
  52.   set the castNum of sprite pSprite = pCast
  53.   return me
  54. end
  55.  
  56. on SwitchList me, NewQuestionList
  57.   set pQuestionList = NewQuestionList
  58.   set pMylist = getat(pThelists, pQuestionList)
  59. end
  60.  
  61. on InitQuestions me, NewLocationV,NewLocationH,NewQuestion1Cast,NewNumberofQuestions,¼
  62.                      theNewFunction1,theNewFunction2,theNewFunction3,theNewFunction4
  63.   set plocationV = NewLocationV
  64.   set plocationH = NewLocationH
  65.   set pQuestion1 = NewQuestion1Cast
  66.   set pQuestion2 = pQuestion1 + 1
  67.   set pQuestion3 = pQuestion1 + 2
  68.   set pQuestion4 = pQuestion1 + 3
  69.   set pNoOfQuestions = NewNumberofQuestions
  70.   set pFunction1 = theNewFunction1
  71.   set pFunction2 = theNewFunction2
  72.   set pFunction3 = theNewFunction3
  73.   set pFunction4 = theNewFunction4
  74. end
  75.  
  76. on InitQuestLocs me, NewLocationV,NewLocationH
  77.   set plocationV = NewLocationV
  78.   set plocationH = NewLocationH
  79. end
  80.  
  81. on RandomQuestion me
  82.   if (pPeriodicTask = FALSE) then
  83.     set ShouldIAsk = random(160)
  84.     if ShouldIAsk = 20 then
  85.       if soundbusy(3) = false then
  86.         set pbeenclicked = false
  87.         puppetsprite psprite, true
  88.         set ChooseQuestion = random(pNoOfQuestions)
  89.         if ChooseQuestion = 1 then
  90.           set x = getaProp(pMylist, pQuestion1)
  91.           set pDestination = pFunction1
  92.           set pTheQuestion = pQuestion1
  93.         else
  94.           if ChooseQuestion = 2 then
  95.             set x = getAProp(pMylist, pQuestion2)
  96.             set pDestination = pFunction2
  97.             set pTheQuestion = pQuestion2
  98.           else
  99.             if ChooseQuestion = 3 then
  100.               set x = getAProp(pMylist, pQuestion3)
  101.               set pDestination = pFunction3
  102.               set pTheQuestion = pQuestion3
  103.             else
  104.               if ChooseQuestion = 4 then
  105.                 set x = getAProp(pMylist, pQuestion4)
  106.                 set pDestination = pFunction4
  107.                 set pTheQuestion = pQuestion4
  108.               end if
  109.             end if
  110.           end if
  111.         end if
  112.         if x = 1 then
  113.           set the locV of sprite pSprite = plocationV
  114.           set the locH of sprite pSprite = plocationH
  115.           updatestage
  116.           wait .3
  117.           set the castnum of sprite pSprite = pCast2
  118.           updatestage
  119.           wait .3
  120.           set the castnum of sprite pSprite = pCast3
  121.           updatestage
  122.           wait .3
  123.           set the castnum of sprite pSprite = pCast4
  124.           updatestage
  125.           wait .3
  126.           set pPeriodicTask = TRUE
  127.           set gQuestCount = 0
  128.           set pQuestionArt = pTheQuestion
  129.           startTimer
  130.         end if
  131.       end if
  132.     else
  133.       nothing
  134.     end if
  135.   end if
  136. end
  137.  
  138. on doPeriodicTask me
  139.   return (pPeriodicTask)
  140. end
  141.  
  142. on flashQuestion me
  143.   set holdCast = the castNum of sprite pSprite
  144.   if (holdCast = pCast4) then 
  145.     set the castnum of sprite pSprite = pCast5
  146.     set gQuestCount = gQuestCount + 1
  147.     updatestage
  148.   else
  149.     set the castnum of sprite pSprite = pCast4
  150.     set gQuestCount = gQuestCount + 1
  151.     updatestage
  152.   end if
  153. end
  154.  
  155.  
  156. on displayQuestionArt me
  157.   --if (not(pPeriodicTask)) then return FALSE
  158.   set pPeriodicTask = FALSE
  159.   set gQuestCount = 0
  160.   set hotspotactive = 1
  161.   set the castnum of sprite pSprite = pTheQuestion
  162.   puppetSprite pHotSprite, TRUE
  163.   set the locH of sprite pHotSprite = plocationH
  164.   set the locV of sprite pHotSprite = plocationV
  165.   updatestage
  166.   repeat while hotspotactive = 1
  167.     ArrowCursor
  168.     if rollover (pHotSprite) then
  169.       repeat while rollover (pHotSprite)
  170.         HandCursor
  171.         if (the mouseDown) then
  172.           resetQuestionMark me
  173.           setAProp pMylist, pTheQuestion, 0
  174.           set hotspotactive = 0
  175.           do pDestination
  176.           return false
  177.         end if
  178.       end repeat
  179.     else
  180.       if (the mouseDown) then
  181.         resetQuestionMark me
  182.         set hotspotactive = 0
  183.         return false
  184.       end if
  185.     end if
  186.   end repeat
  187. end
  188.  
  189. on resetQuestionMark me
  190.   set the locH of sprite psprite = -200
  191.   set the locH of sprite photsprite = -200
  192.   set the castnum of sprite psprite = pCast
  193.   puppetsprite pHotSprite, false
  194.   updatestage
  195.   set gQuestCount = 0
  196.   set pBeenClicked = false
  197.   set pPeriodicTask = FALSE
  198. end
  199.  
  200. on hideControl me
  201.   puppetSprite pSprite, FALSE
  202. end
  203.  
  204. on TurnOnHelpSound me
  205.   set phelpStatus = 1
  206. end
  207.  
  208. on TurnOffHelpSound me
  209.   set phelpStatus = 0
  210. end
  211.  
  212. on setNewSound me, aNewSound 
  213.   set pMySound = aNewSound
  214. end
  215.  
  216. on DoTheFunction me
  217.   do pDestination
  218. end
  219.  
  220. on RolloverJob me
  221.   set checkVoiceover = 0
  222.   if the mousecast = the castnum of sprite 44 then
  223.     repeat while rollover(44)
  224.       HANDCURSOR
  225.       if checkVoiceover = 0 then
  226.         if gTheHelpIsOn = 1 then
  227.           puppetsound pMySound
  228.           updatestage
  229.           set checkVoiceover = 1
  230.         end if
  231.       end if
  232.       if the mousedown then
  233.         set pbeenclicked = 1
  234.       else
  235.         if pbeenclicked = 1 then
  236.           getQuestion
  237.         end if
  238.       end if
  239.     end repeat
  240.   end if
  241. end
  242.  
  243. on CheckClickedStatus me 
  244.   return pbeenclicked
  245. end
  246.  
  247.